import java.util.Scanner;

public class Text {

    //递归求解汉诺塔问题

        public static void main(String[] args) {
            int n = 3;
            char from = 'A';
            char to = 'C';
            char aux = 'B';

            hanoi(n, from, to, aux);
        }

        private static void hanoi(int n, char from, char to, char aux) {
            if (n == 1) {
                System.out.println("将盘子从 " + from + " 移动到 " + to);
                return;
            }
            hanoi(n - 1, from, aux, to);
            System.out.println("将盘子从 " + from + " 移动到 " + to);
            hanoi(n - 1, aux, to, from);
        }




    //在同一个类中定义多个方法：要求不仅可以求2个整数的最大值，还可以求3个小数的最大值？
    public static int Max(int w,int h){
        return w>h?w:h;
    }
    public static double Max(double r,double t,double u){
        return (r>t?r:t)>u?(r>t?r:t):u;
    }

    public static void main4(String[] args) {
        System.out.println(Max(7, 9));
        System.out.println(Max(3.4, 6.1, 4.2));
    }



    //在同一个类中,分别定义求两个整数的方法 和 三个小数之和的方法。 并执行代码，求出结果
    public static int chong_zai(int x,int y){
        return x+y;
    }
    public static double chong_zai(double a,double b,double c){
        return a+b+c;
    }

    public static void main3(String[] args) {
        System.out.println(chong_zai(3, 8));
        System.out.println(chong_zai(3.0, 3.3, 9.5));
    }



    //求斐波那契数列的第n项（用迭代）
    //1，1，2，3，5，8……
    public static int fib(int i){
        if(i==1 ||i==2){
            return 1;
        }
        int a1 = 1;
        int a2 = 1;
        int a3 = 0;
        for(int n = 3;n<=i;n++){
            a3=a1+a2;
            a1=a2;
            a2=a3;
    }
        return a3;
    }

    public static void main2(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int i = scanner.nextInt();
        System.out.println(fib(i));
    }




    public static int max2(int a, int b) {
        return a > b ? a : b;
    }

    public static int max3(int a, int b, int c) {
        return max2(c, max2(a, b));
    }

    public static void main1(String[] args) {
        int result2 = max2(5, 10);
        System.out.println("Max2 " + result2);

        int result3 = max3(5, 18, 15);
        System.out.println("Max3 " + result3);
    }
}